<template>
  <div class="login-page">
    <!-- 图片问题 -->
    <div class="login-logo"></div>
    <div class="login-form">
      <div class="login-form-title">后台管理系统</div>
      <span>去注册</span>
      <div class="form">
        <el-form :model="ruleForm" :rules="rules" ref="form">

            <el-form-item label="用户名" prop="username">
                <el-input v-model="ruleForm.username" placeholder="请输入用户名"></el-input>
            </el-form-item>

            <el-form-item label="密码" prop="password">
                <el-input v-model="ruleForm.password" placeholder="请输入密码"></el-input>
            </el-form-item>

            <el-button type="primary" @click="submitForm">登录</el-button>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import { login } from '@/api/user'

export default {
  name: 'LoginIndex',
  data () {
    return {
      ruleForm: {
        username: '',
        password: ''
      },
      rules: {
        username: [
          {
            required: true,
            message: '请输入用户名',
            trigger: 'blur'
          }
        ],
        password: [
          {
            required: true,
            message: '请输入密码',
            trigger: 'blur'
          }
        ]

      }
    }
  },
  methods: {
    async submitForm () {
      await login(this.ruleForm)
      this.$router.push('/')
    }
  }
}
</script>

<style lang='less' scoped>
.login-page {
  width: 1440px;
  height: 1024px;
  //   width: 100vw;
  //   height: 100vh;
  background-color: #fcfcff;
  background: url(@/assets/login-images/登录注册bg@2x.png) no-repeat;
  .login-logo {
    margin-top: 30px;
    margin-left: 50px;
    width: 110px;
    height: 48px;
    background: url(@/assets/login-images/登录页logo.svg) no-repeat center / cover;
    // opacity: 0;
  }
  .login-form {
    width: 540px;
    height: 560px;
    margin: 154px 450px 232px;
    background: #ffffff;
    box-shadow: 0px 0px 28px 0px rgba(21, 43, 99, 0.08);
    border-radius: 8px;
    border: 1px solid transparent;
    .login-form-title {
      width: 192px;
      height: 44px;
      margin: 48px 174px 8px;
      font-family: PingFangSC-Regular;
      font-size: 32px;
      color: #131523;
      letter-spacing: 0;
      text-align: center;
      line-height: 44px;
      font-weight: 400;
    }
    span {
      display: block;
      font-family: PingFangSC-Regular;
      font-size: 16px;
      color: #1e5eff;
      letter-spacing: 0;
      text-align: center;
      line-height: 24px;
      &:hover{
        color:#7fa2fc
      }
    }
    .form{
      padding: 40px 60px 60px 60px;
      .el-button{
        width: 420px;
        height: 48px;
        &:hover{
          background-color:#608DFF
        }
      }
    }
  }
}
</style>
